var form,$,table,layer,upload,node;
var user = JSON.parse(localStorage.getItem("user"));
var userId = user.userId;
layui.use(['form','jquery','table','layer','upload'],function() {
    form = layui.form;
    $ = layui.jquery;
    table = layui.table;
    layer = layui.layer;
    upload = layui.upload;
    //获取审核日志列表数据
    getAuditLogList('','','');
});

////获取审核日志列表信息
function getAuditLogList(aduitLogType, type, trueName){
    $.ajax({
        url: '/toExamine/getAllAuditLog',
        type: 'post',
        dataType: 'json',
        data: {
            'aduitLogType': aduitLogType,
            'type': type,
            'trueName': trueName,
        },
        success:function (item) {
            showAuditLogList(item.data);
        }
    });
}

function showAuditLogList(data) {
    table.render({
        elem: "#demo",
        data: data,
        toolbar:'#toolutil',
        page: true,
        limit: 10,
        cols:[[
            {title:'序号', align:'center',unresize:true, templet:function (data) {
                    return data.LAY_INDEX;
                }},
            {field:'aduitLogType',title:'审核类型', align:'center',unresize:true, templet:function (data) {
                    if (data.aduitLogType == 1){
                        return '商品';
                    }else if(data.aduitLogType == 2){
                        return '课程';
                    }else if (data.aduitLogType == 3){
                        return '微圈';
                    }else if (data.aduitLogType == 4){
                        return '用户';
                    }
                }},
            {field:'trueName',title:'审核人',align:'center',unresize:true},
            {field:'type',title:'审核状态',align:'center',unresize:true, templet:function (data) {
                    if (data.type == 1){
                        return '未通过';
                    }else if (data.type == 2){
                        return '已通过';
                    }
                }},
            {field:'createDate',title:'审核时间',align:'center',unresize:true},
            {field:'remark',title:'备注',align:'center',unresize:true},
        ]]
    });
}
//搜索
$("#selAuditLog").on("click",function () {
    var aduitLogType = $('select[name=aduitLogType]').val();
    var type = $("select[name=type]").val();
    var trueName = $("input[name=trueName]").val();
    console.log(aduitLogType + " " + type + " " + trueName);
    getAuditLogList(aduitLogType,type,trueName);
});
//刷新
function refresh() {
    location.reload();
}

//返回首页
function backOff(){
    parent.jumpSystemHome();
}